<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 12528
  Date: 2022/4/6
  Time: 19:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>余额查询</title>
    <link rel="stylesheet" type="text/css" href='<c:url context="${pageContext.request.contextPath}" value="/easyui/themes/default/easyui.css"/>'>
    <link rel="stylesheet" type="text/css" href='<c:url context="${pageContext.request.contextPath}" value="/easyui/themes/icon.css"/>'>
    <link rel="stylesheet" type="text/css" href='<c:url context="${pageContext.request.contextPath}" value="/easyui/css/demo.css"/>'>
    <script type="text/javascript" src='<c:url context="${pageContext.request.contextPath}" value="/easyui/jquery.min.js"/>'></script>
    <script type="text/javascript" src='<c:url context="${pageContext.request.contextPath}" value="/easyui/jquery.easyui.min.js"/>'></script>
    <script type="text/javascript" src='<c:url context="${pageContext.request.contextPath}" value="/easyui/js/validateExtends.js"/>'></script>
    <script type="text/javascript"
            src='<c:url context="${pageContext.request.contextPath}" value="/easyui/js/easyui-lang-zh_CN.js"/>'></script>

    <script type="text/javascript">
        $(function() {
            //datagrid初始化
            $('#dataList').datagrid({
                title:'余额查询',
                iconCls:'icon-more',//图标
                border: true,
                collapsible: false,//是否可折叠的
                fit: true,//自动大小
                method: "get",
                url:"/MSOS/getaccount?action=data",
                idField:'uid',
                singleSelect: true,//是否单选
                pagination: false,//分页控件
                rownumbers: true,//行号
                sortName: 'uid',
                sortOrder: 'ASC',
                remoteSort: false,
                columns: [[
                    {field:'chk',checkbox: true,width:50},
                    {field:'uid',title:'用户编号',width:200, sortable: true},
                    {field:'username',title:'用户名',width:200},
                    {field:'phone',title:'手机号',width:200},
                    {field:'balance',title:'余额',width:200},
                ]],
                toolbar: "#toolbar"
            });
            //设置工具类按钮
            $("#add").click(function () {
                $("#addDialog").dialog("open");
            });

            //设置添加窗口
            $("#addDialog").dialog({
                title: "查询余额",
                width: 450,
                height: 250,
                iconCls: "icon-add",
                modal: true,
                collapsible: false,
                minimizable: false,
                maximizable: false,
                draggable: true,
                closed: true,
                buttons: [
                    {
                        text: '查看',
                        plain: true,
                        iconCls: 'icon-book-add',
                        handler: function () {
                            var phone = $("#add_name").textbox("getValue");
                            var password = $("#add_gradeList").textbox("getValue");
                            if (phone == null || password == null) {
                                $.messager.alert("消息提醒", "请检查你输入的数据!", "warning");
                                return;
                            } else {
                                $.ajax({
                                    type: "post",
                                    url: "/MSOS/getaccount?phone="+phone+"&password="+password,
                                    success: function (msg) {
                                        if (msg.status == 200) {
                                            $.messager.alert("消息提醒", "该用户的账户余额为："+msg.msg+" 元", "info");
                                            //关闭窗口
                                            $("#addDialog").dialog("close");
                                            //清空原表格数据
                                            $("#add_name").textbox('setValue', "");
                                            //刷新
                                            $('#dataList').datagrid("reload");
                                        } else {
                                            $.messager.alert("消息提醒", msg.msg, "warning");
                                            return;
                                        }
                                    }
                                });
                            }
                        }
                    },
                    {
                        text: '重置',
                        plain: true,
                        iconCls: 'icon-book-reset',
                        handler: function () {
                            $("#add_name").textbox('setValue', "");
                        }
                    },
                ]
            });

        });
    </script>
</head>
<body>
<!-- 数据列表 -->
<table id="dataList" cellspacing="0" cellpadding="0">
</table>

<!-- 工具栏 -->
<div id="toolbar">
    <div style="float: left;"><a id="add" href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">查看其他手机号余额</a></div>
</div>

<!-- 查询窗口 -->
<div id="addDialog" style="padding: 10px">
    <form id="addForm" method="post">
        <table cellpadding="8" >
            <tr>
                <td>手机号:</td>
                <td><input id="add_name" style="width: 200px; height: 30px;" class="easyui-textbox" type="text" name="phone" data-options="required:true, missingMessage:'不能为空'" /></td>
            </tr>
            <tr>
                <td>密码:</td>
                <td><input id="add_gradeList" style="width: 200px; height: 30px;" class="easyui-textbox" type="text" name="password" data-options="required:true, missingMessage:'不能为空'" /></td>
            </tr>
        </table>
    </form>
</div>

</body>
</html>
